#include"hashtable.h"

namespace ybc
{
	template<class K, class Hash = hash<K>>
	class unordered_set
	{
		typedef const K T;

		struct SetKeyOfT
		{
			const K& operator () (const T& k)
			{
				return k;
			}
		};
	public:
		typedef typename hashtable<K, T, SetKeyOfT, Hash>::iterator iterator;
		typedef typename hashtable<K, T, SetKeyOfT, Hash>::const_iterator const_iterator;

		iterator begin()
		{
			return _ht.begin();
		}

		iterator end()
		{
			return _ht.end();
		}

		const_iterator cbegin() const
		{
			return _ht.cbegin();
		}

		const_iterator cend() const
		{
			return _ht.cend();
		}

		pair<iterator, bool> insert(const T& k)
		{
			return _ht.insert(k);
		}

		iterator find(const K& key)
		{
			return _ht.find(key);
		}

		bool erase(const K& key)
		{
			return _ht.erase(key);
		}
	private:
		hashtable<K, T, SetKeyOfT, Hash> _ht;
	};
}